<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>添加分类页</title>
</head>
<body>
<form id="form">
	<table>
		<tr>
			<th>分类名：</th>
			<th><input type="text" name="name"></th>
			<th><input type="button" id="active" value="添加分类"></th>
		</tr>
	</table>
</form>
<script src="/static/news/js/jquery-1.12.4.min.js"></script>
<script>

	$("#active").click(function () {
		formdata = new FormData($("#form")[0]);
		$.ajax({
			url:"/addcate",
			method:"post",
			data:formdata,
			processData:false,
			contentType:false,
			success:function (formdata) {
				alert("添加成功");
				console.log(formdata)
            },
			error:function (error) {
				alert("添加失败");
				console.log(error)
            }
		})
    })

</script>
</body>
</html>